#pragma once

#include <uapi/linux/types.h>

static inline uint32_t __swab32(uint32_t x)
{
    return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
            ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
}

/**
 * __swab32p - return a byteswapped 32-bit value from a pointer
 * @p: pointer to a naturally-aligned 32-bit value
 */
static inline uint32_t __swab32p(const uint32_t *p)
{
    return __swab32(*p);
}
